Skip to content

Conversation

sunyuhan1998
Copy link
Contributor

@sunyuhan1998 sunyuhan1998 commented Jul 25, 2025

This PR is essentially an independent implementation aimed at achieving #3905.

The issue mentions our need to support OpenAI's Batch API. I noticed that the Batch API is built on top of the Files API, and besides the Batch API, components such as Assistants and Fine-tuning also depend on the Files API. Therefore, I believe we should implement support for these APIs step by step.

This PR first adds support for the Files API.

What does this PR do:

  1. Introduced an OpenAiFileApi class that provides full support for OpenAI's Files API.
  2. Implemented corresponding unit tests and integration tests.

The OpenAiFileApi class mainly includes the following methods:

Method Name Function Description
uploadFile(UploadFileRequest) Upload a file that can be used across various endpoints
listFiles(ListFileRequest) Returns a list of files
retrieveFile(String) Returns information about a specific file
deleteFile(String) Delete a file
retrieveFileContent(String) Returns the contents of the specified file

The implementation of the above interfaces strictly follows OpenAI's official documentation: Files API

1. Introduced the OpenAiFileApi class.
2. Implemented corresponding unit tests and integration tests.

Signed-off-by: Sun Yuhan <[email protected]>
@sunyuhan1998
Copy link
Contributor Author

Hi @markpollack, What do you think about this? Could you please help review it?

@frq-frk
Copy link

frq-frk commented Sep 11, 2025

I’m planning to build Batch API support based on this—thanks for the clean implementation! Let me know if you foresee any changes that might affect downstream usage.

@sunyuhan1998
Copy link
Contributor Author

I’m planning to build Batch API support based on this—thanks for the clean implementation! Let me know if you foresee any changes that might affect downstream usage.

No problem! BTW, @ilayaperumalg, could you please help review the current PR?

@sunyuhan1998
Copy link
Contributor Author

Just synchronized the latest main branch code and corrected the code style according to the latest checkstyle guidelines.

@ilayaperumalg ilayaperumalg self-assigned this Sep 24, 2025
@ilayaperumalg ilayaperumalg added this to the 1.1.0.M3 milestone Sep 24, 2025
@ilayaperumalg
Copy link
Member

@sunyuhan1998 Thanks for adding the support for File API. LGTM, merging.

@ilayaperumalg
Copy link
Member

Squashed, rebased and merged as 087393b

@ilayaperumalg
Copy link
Member

@sunyuhan1998 Could you add documentation for this change?

@sunyuhan1998
Copy link
Contributor Author

@sunyuhan1998 Could you add documentation for this change?

No problem, I'll submit a new PR soon to add the relevant documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants